<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    //this是静态的
    let t1 = () => {
      console.log("箭头函数声明")
    }
    var sex = 'man'
    let t2 = () => {
      console.log("t2里面的this.sex---", this.sex)
    }

    function t3() {
      console.log("t3里面的this.sex---", this.sex)
    }
    const change = {
      sex: 'female'
    }

    t2()
    t3()
    t2.call(change)
    t3.call(change)
    //bind是相当于复制一个新函数，然后将this指向{sex: 'bindsex'}
    let t4 = t3.bind({
      sex: 'bindsex'
    })
    t4()



    function fun(...arg) {
      console.log("fun----this", this);
      console.log("arg-----", arg);
    }
    let t5 = fun.bind({
      b: 2
    }, 55, 44)
    t5(3, 4, 5)
    //[55, 44, 3, 4, 5]

    //不能作为构造实例化对象
    let Person = (name, age) => {
      name,
      age
    }
    // person1 = new Person()
    // console.log(person1)
    //Person is not a constructor

    //不能使用arguments
    let t10 = () => {
      console.log(arguments)
    }
    //t10()
    //ReferenceError: arguments is not defined
    //箭头函数的简约
    let add = adress => console.log(adress)
    add('china')
  </script>
</head>

<body>

</body>

</html>